package org.yenn.pattern.aliyun.creational.builder;

import org.junit.Test;

/**
 * 步骤 7
 * BuiderPatternDemo 使用 MealBuider 来演示建造者模式（Builder Pattern）。
 *
 * BuilderPatternDemo.java
 */
public class BuilderPatternDemo {
    /**
     * 步骤 8
     * 验证输出。
     * Veg Meal
     * Item : Veg Burger, Packing : Wrapper, Price : 25.0
     * Item : Coke, Packing : Bottle, Price : 30.0
     * Total Cost: 55.0
     *
     *
     * Non-Veg Meal
     * Item : Chicken Burger, Packing : Wrapper, Price : 50.5
     * Item : Pepsi, Packing : Bottle, Price : 35.0
     * Total Cost: 85.5
     */
    @Test
    public void prepareVegMeal() {
        MealBuilder mealBuilder = new MealBuilder();

        Meal vegMeal = mealBuilder.prepareVegMeal();
        System.out.println("Veg Meal");
        vegMeal.showItems();
        System.out.println("Total Cost: " +vegMeal.getCost());
    }

    @Test
    public void prepareNonVegMeal() {
        MealBuilder mealBuilder = new MealBuilder();

        Meal nonVegMeal = mealBuilder.prepareNonVegMeal();
        System.out.println("\n\nNon-Veg Meal");
        nonVegMeal.showItems();
        System.out.println("Total Cost: " +nonVegMeal.getCost());
    }
}